﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrimaryAlgorithm.ReverseString
{
    class MainProject
    {
        static void Main(string[] args)
        {
            char[] s = new char[] { 'h' ,'e','l','l','o'};
            ReverseString(s);
            foreach (var item in s)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine();
            Console.ReadKey();
        }
        public static void ReverseString(char[] s)
        {
            //队列辅助
            Queue<char> que = new Queue<char>();
            foreach (var item in s)
            {
                que.Enqueue(item);
            }
            for (int i = s.Length-1; i >=0; i--)
            {
                s[i] = que.Dequeue();
            }
        }
    }
}
